//    Copyright (C) Kherty.  All rights reserved.
using System.Collections.Generic;
using OpenLS.Core.Serialization;

namespace OpenLS.Spreadsheet
{
	public class CustomSheetView: IOfficeXmlSerializable
	{
		#region IOfficeXmlSerializable Members

		void IOfficeXmlSerializable.ReadXml(ReadContext context)
		{
			using (ReadContext c = context.Read("customSheetView"))
			{
				Guid = c.GetString("guid");

				Pane = c.ReadOptionalElement<Pane>("pane");
				selection = c.ReadOptionalElement<InternalSelection>("selection");
				RowBreaks.Clear();
				List<Break> brs = c.ReadOptionalListElement<Break>("rowBreaks", "brk");
				if (brs != null)
					RowBreaks.AddRange(brs);

				ColumnBreaks.Clear();
				brs = c.ReadOptionalListElement<Break>("colBreaks", "brk");
				if (brs != null)
					ColumnBreaks.AddRange(brs);

				//rowBreaks = c.ReadOptionalElementAs<PageBreaks>("rowBreaks");
				//colBreaks = c.ReadOptionalElementAs<PageBreaks>("colBreaks");
				pageMargins = c.ReadOptionalElement<PageMargins>("pageMargins");
				printOptions = c.ReadOptionalElement<PrintOptions>("printOptions");
				PageSetup = c.ReadOptionalElement<PageSetup>("pageSetup");
				HeaderFooter = c.ReadOptionalElement<HeaderFooter>("headerFooter");
				AutoFilter = c.ReadOptionalElement<AutoFilter>("autoFilter");
				Extension = c.ReadOptionalElement<ExtensionElement>("extLst");
			}
		}

		void IOfficeXmlSerializable.WriteXml(WriteContext context)
		{
			using (WriteContext c = context.Write("customSheetView"))
			{
				c.SetString("guid", Guid);

				c.WriteOptionalElement(Pane);
				c.WriteOptionalElement(selection);
				PageBreaks.WriteBreaks(RowBreaks, c, "rowBreaks");
				PageBreaks.WriteBreaks(ColumnBreaks, c, "colBreaks");
				c.WriteOptionalElement(PageMargins);
				c.WriteOptionalElement(PrintOptions);
				c.WriteOptionalElement(PageSetup);
				c.WriteOptionalElement(HeaderFooter);
				c.WriteOptionalElement(AutoFilter);
				c.WriteOptionalElement(Extension);
			}
		}

		#endregion

		private ExtensionElement _extension;

		public ExtensionElement Extension
		{
			get { return _extension; }
			set { _extension = value; }
		}
	


		private string guid;

		public string Guid
		{
			get { return guid; }
			set { guid = value; }
		}

		private int scale;

		public int Scale
		{
			get { return scale; }
			set { scale = value; }
		}
		private int colorId;

		public int ColorId
		{
			get { return colorId; }
			set { colorId = value; }
		}
		private bool showPageBreaks;

		public bool ShowPageBreaks //\\name?
		{
			get { return showPageBreaks; }
			set { showPageBreaks = value; }
		}
		private bool showFormulas;

		public bool ShowFormulas //\\name?
		{
			get { return showFormulas; }
			set { showFormulas = value; }
		}
		private bool showGridLines = true;

		public bool GridLinesVisible 
		{
			get { return showGridLines; }
			set { showGridLines = value; }
		}
		private bool showRowCol = true;

		public bool ShowRowCol//\\names?
		{
			get { return showRowCol; }
			set { showRowCol = value; }
		}
		private bool outlineSymbols = true;

		public bool OutlineSymbols
		{
			get { return outlineSymbols; }
			set { outlineSymbols = value; }
		}
		private bool zeroValues = true;

		public bool ZeroValues
		{
			get { return zeroValues; }
			set { zeroValues = value; }
		}
		private bool fitToPage;

		public bool FitToPage
		{
			get { return fitToPage; }
			set { fitToPage = value; }
		}
		private bool printArea;

		public bool PrintArea
		{
			get { return printArea; }
			set { printArea = value; }
		}
		private bool filter;

		public bool Filter
		{
			get { return filter; }
			set { filter = value; }
		}
		private bool showAutoFilter;

		public bool ShowAutoFilter
		{
			get { return showAutoFilter; }
			set { showAutoFilter = value; }
		}
		private bool hiddenRows;

		public bool HiddenRows
		{
			get { return hiddenRows; }
			set { hiddenRows = value; }
		}
		private bool hiddenColumns;

		public bool HiddenColumns
		{
			get { return hiddenColumns; }
			set { hiddenColumns = value; }
		}
		private SheetState state = SheetState.Visible;

		public SheetState State
		{
			get { return state ; }
			set { state  = value; }
		}
		private bool filterUnique;

		public bool FilterUnique
		{
			get { return filterUnique; }
			set { filterUnique = value; }
		}

		private InternalSelection selection;

		internal InternalSelection Selection
		{
			get { return selection; }
			set { selection = value; }
		}
	
		private SheetViewType view = SheetViewType.Normal;

		public SheetViewType View
		{
			get { return view; }
			set { view = value; }
		}
		private bool showRuler = true;

		public bool ShowRuler
		{
			get { return showRuler; }
			set { showRuler = value; }
		}
		private string topLeftCell;

		public string TopLeftCell
		{
			get { return topLeftCell; }
			set { topLeftCell = value; }
		}
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	

		private Pane pane;

		internal Pane Pane
		{
			get { return pane; }
			set { pane = value; }
		}
		private List<Break> rowBreaks = new List<Break>();

		public List<Break> RowBreaks
		{
			get { return rowBreaks; }
			//\\private set { rowBreaks = value; }
		}
		private List<Break> colBreaks = new List<Break>();

		public List<Break> ColumnBreaks
		{
			get { return colBreaks; }
			//\\private set { colBreaks = value; }
		}
		private PageMargins pageMargins;

		public PageMargins PageMargins
		{
			get { return pageMargins; }
			set { pageMargins = value; }
		}

		private PrintOptions printOptions;

		public PrintOptions PrintOptions
		{
			get { return printOptions; }
			set { printOptions = value; }
		}
		private PageSetup pageSetup;

		public PageSetup PageSetup
		{
			get { return pageSetup; }
			set { pageSetup = value; }
		}
		private HeaderFooter headerFooter;

		public HeaderFooter HeaderFooter
		{
			get { return headerFooter; }
			set { headerFooter = value; }
		}
		private AutoFilter autoFilter;

		public AutoFilter AutoFilter
		{
			get { return autoFilter; }
			set { autoFilter = value; }
		}
	
	
	
	
	
	
	
	
	}
}
